package Week3.J0501;

import java.io.*;
import java.util.*;

public class 模板_拓扑排序_xv {
    public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();

    static int n, m;
    static Map<Integer, List<Integer>> edges = new HashMap<>(); // 临界链表 存储图
    static int[] cnt; // 统计每个点入度信息

    public static void main(String[] args) throws IOException{
        n = in.nextInt(); m = in.nextInt();
        cnt = new int[n+1];
        // 读入 m 条边

        // 1. 建图
        for (int i = 0; i < m; i++) {
            int a = in.nextInt(); int b = in.nextInt();
            // 找到 a -> b 的一条边
            cnt[b]++; // 统计 b 的入度信息
            if (!edges.containsKey(a)) {
                // 如果哈希表中没有a, new LinkedList放入
                edges.put(a, new ArrayList<>());
            }
            edges.get(a).add(b); //get(a)拿到 a 的链表, 把 b 放入
        }

        // 2. 拓扑排序
        // 入度为 0 的点, 存到队列中
        Queue<Integer> queue = new LinkedList<>();
        for (int i = 1; i <= n; i++) {
            if (cnt[i] == 0) {
                queue.add(i);
            }
        }

        int[] ret = new int[n]; // 统计拓扑排序结果
        int pos = 0;

        //对队列 bfs
        while (!queue.isEmpty()) {
            int t = queue.poll();
            ret[pos++] = t;

            for (int a : edges.getOrDefault(t, new ArrayList<>())) {
                cnt[a]--;
                if (cnt[a] == 0) {
                    queue.add(a);
                }
            }
        }

        if (pos == n) {
            for (int i = 0; i < n-1; i++) {
                out.print(ret[i] + " ");
            }
            out.println(ret[n-1]);
        }else out.println(-1);

        out.close();
    }
}






class Read {//自定义快读读入
    //字符串裁剪
    StringTokenizer st = new StringTokenizer("");

    //1.字节流System.in->字符流InputStreamReader
    //2.带内存缓冲区的字符流BufferedReader
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));


    String next() throws IOException {
        //为什么要while循环，因为可能读取的数据不止一行，有多行就需要多次取
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(bf.readLine());//先拿一行的数据
        }
        return st.nextToken();//对这一行的数据进行裁剪，拿到第一个数据
    }

    String nextLine() throws IOException {
        return bf.readLine();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}